gnttab: fix pin count / page reference race
authorJan Beulich <jbeulich@suse.com>
Tue, 24 Oct 2017 14:01:33 +0000 (16:01 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 24 Oct 2017 14:01:33 +0000 (16:01 +0200)
commite008f7619dcd6d549727c9635b3f9f3c7ee483ed
treeafee97223bb74c467c335b2c32d27a9fcd880394
parent1f2c7894dfe3d52f33655de202bd474999a1637b
gnttab: fix pin count / page reference race

Dropping page references before decrementing pin counts is a bad idea
if assumptions are being made that a non-zero pin count implies a valid
page. Fix the order of operations in gnttab_copy_release_buf(), but at
the same time also remove the assertion that was found to trigger:
map_grant_ref() also has the potential of causing a race here, and
changing the order of operations there would likely be quite a bit more
involved.

This is CVE-2017-15597 / XSA-236.

Reported-by: Pawel Wieczorkiewicz <wipawel@amazon.de>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/common/grant_table.c